using System;
using SoftwareMonkeys.Scriptech.Business;
using SoftwareMonkeys.Scriptech.Diagnostics;

namespace SoftwareMonkeys.Scriptech.Scripts
{
	public class ScriptProcessStarter
	{
		public ScriptProcessStarter ()
		{
		}
		
		public ScriptProcess Start(Guid processID, string title)
		{
			ScriptProcess process = new ScriptProcess();
			
			using (LogGroup logGroup = LogGroup.StartDebug("Starting a script process."))
			{
				if (processID == Guid.Empty)
					processID = Guid.NewGuid();
				
				process.ID = processID;
				process.Title = title;
				
				LogWriter.Debug("Title: " + title);
				
				process.Output = "Starting...";
				
				// TODO: Remove false parameter from strategy new function
				SaveStrategy.New(process, false).Save(process);
				
			}
			return process;
		}
	}
}

